# 练习python 的游戏编程
import random

currentTimes = 0
minNumber = 1
maxNumber = 20
guessMaxTimes = 6
guessNumber = random.randint(minNumber,maxNumber)


print("What is your name ?")
userName = input()
print("Heyy,{}~Let \'s go to guess a number between {} and {}.".format(userName,minNumber,maxNumber))


while currentTimes < guessMaxTimes:
    # 次数加一
    currentTimes = currentTimes + 1
    if currentTimes >= guessMaxTimes:
        print("The times area over!")
        break
    print("Please input a number between {} and {}.".format(minNumber,maxNumber));
    currentNum = int(input())
    if currentNum == guessNumber:
        print("Congratulations! You\' re right ~ {}".format(userName))
        break
    elif currentNum > guessNumber:
        print("Your number is higher than guess number~",end=userName)
    elif currentNum < guessNumber:
        print("Your number is lower than guess number~",end=userName)

